package per.hx.bs.restcontroller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import per.hx.bs.base.WxBaseController;
import per.hx.bs.base.domain.ReturnDTO;
import per.hx.bs.service.RedisService;
import per.hx.bs.service.WxService;

import javax.servlet.http.HttpServletRequest;

/**
 * @author HuXing
 * @date 2018/5/10  14:05
 */

@RestController
@RequestMapping(value = "/login")
public class LoginController extends WxBaseController {


    private final
    WxService wxService;

    @Autowired
    public LoginController(WxService wxService, RedisService redisService) {
        super(redisService);
        this.wxService = wxService;
    }

    @GetMapping
    public ReturnDTO wxLogin(@RequestParam String code) {
        return ReturnDTO.ok("获取成功", wxService.getToken(code));
    }
}
